CREATE TABLE [dbo].[DnnProduct_ContentItems_Tags]
(
[ContentItemTagID] [int] NOT NULL IDENTITY(1, 1),
[ContentItemID] [int] NOT NULL,
[TermID] [int] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[DnnProduct_ContentItems_Tags] ADD CONSTRAINT [PK_DnnProduct_ContentItems_Tags] PRIMARY KEY CLUSTERED  ([ContentItemTagID]) ON [PRIMARY]
GO
CREATE UNIQUE NONCLUSTERED INDEX [IX_DnnProduct_ContentItems_Tags] ON [dbo].[DnnProduct_ContentItems_Tags] ([ContentItemID], [TermID]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_DnnProduct_ContentItems_Tags_TermID] ON [dbo].[DnnProduct_ContentItems_Tags] ([TermID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[DnnProduct_ContentItems_Tags] ADD CONSTRAINT [FK_DnnProduct_ContentItems_Tags_DnnProduct_ContentItems] FOREIGN KEY ([ContentItemID]) REFERENCES [dbo].[DnnProduct_ContentItems] ([ContentItemID]) ON DELETE CASCADE ON UPDATE CASCADE
GO
ALTER TABLE [dbo].[DnnProduct_ContentItems_Tags] ADD CONSTRAINT [FK_DnnProduct_ContentItems_Tags_DnnProduct_Taxonomy_Terms] FOREIGN KEY ([TermID]) REFERENCES [dbo].[DnnProduct_Taxonomy_Terms] ([TermID]) ON DELETE CASCADE ON UPDATE CASCADE
GO
